package acm.usa2007.gnewyork;

import java.util.Scanner;

/*
 * p3004
 * Greater New York 2007
 */

public class p3004 {

	static int N, id;
	static String s;

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);
		N = scanner.nextInt();
		for (int i=1;i<=N;++i) {
			id = scanner.nextInt();
			s = scanner.next();
			System.out.print(i + " ");
			for (int j=0;j<s.length();++j) {
				if (j!= id-1) {
					System.out.print(s.charAt(j));
				}
			}
			System.out.println();
		}

	}

}
